//
//  NSArray+DMModelJastor.m
//  dmlib
//
//  Created by JK on 09/05/2017.
//  Copyright © 2017 Shanghai DataSeed Information Technology Co.,Ltd. All rights reserved.
//

#import "NSArray+JKModel.h"
#import "NSArray+Traversal.h"

@implementation NSArray (JKModel)

+ (BOOL)areModels: (NSArray<JKModel*>*)models equalToModels: (NSArray<JKModel*>*)otherModels
{
    NSArray* dicArray =  [JKModel dictionaryArrayFromObjectArray:models];
    NSArray* otherDicArray = [JKModel dictionaryArrayFromObjectArray:otherModels];
    return dicArray == otherDicArray || (dicArray != nil && [otherDicArray isEqualToArray:dicArray]);
}

- (instancetype)JK_deepCopyModels
{
    return [self arrayByMappingArrayWithBlock:^id(NSInteger index, id object) {
        return [object copy];
    }];
}

@end
